package com.liuhuan.blogs.controller;


import com.liuhuan.blogs.config.security.JwtTokenUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "User")
@RestController
@RequestMapping("/aip/user")
public class UserController {

    @Autowired
    private JwtTokenUtil jwtTokenUtil;


    @ApiOperation(value = " 登录", httpMethod = "POST")
    @RequestMapping("/login")
    public String helloWorld(String s) {
        UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken("111", "111");
        SecurityContextHolder.getContext().setAuthentication(authentication);
        return jwtTokenUtil.generateToken("x");
    }
}
